<?php	
 /**
    * @author 0x35
    * @package apl
    * @subpackage base    
    */
 
	/**
	 * @ignore
	 */
    if( defined( "APL_CORE" ) ) return;
    define("APL_CORE","APL_CORE");
	
    /**
     * Main class for common functions
     *
     * @package apl
 	 * @subpackage base
     */
    class Apl
    {
    	/**
    	 * Copies the contents of array
    	 *
    	 * @param Array $array : Source
    	 * @param Array $copy  : Destination
    	 */
    	public static function copyArray (&$array, &$copy) 
    	{
   			if(!is_array($copy))
   				$copy = array();

   			foreach($array as $k => $v) 
   			{
       			if(is_array($v))
       			{
           			Apl::copyArray($v,$copy[$k]);
       			}
       			else
       			{
           			$copy[$k] = $v;
       			}
   			}
		}
		/**
		 * Generates a random word
		 *
		 * @param Integer $paramWordLength : Length of the word
		 * @return String
		 */
		public static function generateRandomWord($paramWordLength)
		{
			$word_array=explode(",","a,b,c,d,e,f,g,!,,h,A,B,C,F,H,T,E,O,P,j,L,k,n,m,o,q,w,s,p,O,P,W,S,D,1,2,4,3,7,6,5,8,7,9,K,_,U");
		
			$l = intval($paramWordLength);
			$word = "";
			for($i = 1; $i <= $l ; $i++)
			{
				$idx = rand(1,count($word_array)-1);
				$word = $word. $word_array[$idx];
			}
			return $word;
		}
        /**
        * Famous oracle nvl function :)
        */
        public static function nvl( $variable,$valueIfNotSet )
        {
            return (!isset( $variable ))?$valueIfNotSet:empty($variable)?$valueIfNotSet:$variable;
        }
        
    }
?>